package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.ModelAccountMonthMapper;
import com.ttg.model.pojo.ModelAccountMonth;
import com.ttg.model.pojo.ModelMctMonth;
import com.ttg.model.vo.ModelAccountMonthSumVO;
import com.ttg.web.dao.ModelAccountMonthDao;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TblModelAccountMonth) daoImpl
 *
 * @author chenyou
 * @datetime 2025-11-14 14:12:52
 */
@Service
public class ModelAccountMonthDaoImpl extends ServiceImpl<ModelAccountMonthMapper, ModelAccountMonth> implements ModelAccountMonthDao {

    @Override
    public boolean deleteByYearAndMonth(String year, String month) {
        LambdaQueryWrapper<ModelAccountMonth> w = new LambdaQueryWrapper<>();
        w.eq(ModelAccountMonth::getYear,year)
                .eq(ModelAccountMonth::getMonth,month);
        return baseMapper.delete(w)>0;
    }

    @Override
    public ModelAccountMonthSumVO getBindAcctMonthByIndustry(String year, String month, Integer actType, List<Long> mctNos) {
        return baseMapper.getAcctMonthByIndustry(year, month, actType, mctNos);
    }

    @Override
    public ModelAccountMonthSumVO getAllAcctMonthByIndustry(String year, String month, List<Long> mctNos) {
        return baseMapper.getAcctMonthByIndustry(year, month, null, mctNos);
    }

    @Override
    public ModelAccountMonthSumVO getCreditAcctMonthByIndustry(String year, String month, List<Long> mctNos) {
        return baseMapper.getCreditAcctMonthByIndustry(year, month, mctNos);
    }

}

